local t = LoadFallbackB();

local songoptions = GAMESTATE:GetSongOptionsString();
local ratemod = string.match(songoptions, "%d.%d");
if ratemod then
	ratemod = tonumber(ratemod);
else
	ratemod = 1.0
end

local function DisplayBPM()
	local bpm = GAMESTATE:GetCurrentSong():GetDisplayBpms();
	local display = "";
		
	--if a single bpm suffices
	if bpm[1] == bpm[2] then
		display = round(bpm[1]) * ratemod
		
	-- if we have a range of bpms
	else
		display = round(bpm[1]) * ratemod .. "/" .. round(bpm[2]) * ratemod
	end

	return "" .. display .. "";
end

local t = Def.ActorFrame{
	InitCommand=cmd(xy,SCREEN_CENTER_X,0);
	
	LoadFont("_common 20px")..{
		Name="DummySpeedModTitle";
		Text="";
		InitCommand=cmd(maxwidth,100;zoom,1;shadowlength,1;shadowcolor,color("0,0,0,0.8");strokecolor,color("0,0,0,0.2");halign, 1);
		OnCommand=function(self)
			local x = 124.5;
			local y = 41;
			self:xy(x, y);		
			
			if ratemod >= 1.01 or ratemod <= 0.99 then
			self:settext( DisplayBPM() );
			end;	
			
		end;
	};
};


if ratemod >= 1.01 or ratemod <= 0.99 then

t[#t+1] = Def.ActorFrame{
	LoadActor("__rate")..{
		InitCommand=cmd(x,SCREEN_CENTER_X-200;y,SCREEN_CENTER_Y-199;draworder,500;);
		OnCommand=cmd(zoom,0.7);
	};
};
end

return t